<template>
	<view class="container m-1">
		<view class="d-flex flex-wrap justify-content-between">
			<u-lazy-load style="width: 49%;margin-bottom: 10rpx;" v-for="(item, index) in list" :index="index" :key="index" :image="item.src" border-radius="20"></u-lazy-load>
		</view>
		<!-- 使用自定义组件 -->
		<!-- <img-boder src="http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg" @imgClick="click"></img-boder> -->
	</view>
</template>

<script>
	// 引入自定义组件
	import imgBoder from '../../components/img-boder.vue'
	export default {
		// 注册自定义组件
		components: {
			imgBoder
		},
		data() {
			return {
				action: null,
				list: [
					{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},
					{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},{
						src: "http://localhost:8080/upload/2019/10/28/14/cac9f1c7-a8c8-4b67-819f-1d0157ebaecf.jpg",
					},
				]
			}
		},
		onLoad(option) {
			// console.log(option);
			this.action = option.action;
			if (this.action) {
				uni.setNavigationBarTitle({
					title: option.action
				});
			}
		},
		methods: {
			click(res){
				console.log(res);
			}
		},
		onNavigationBarButtonTap(res) {
			console.log(res.index);
			if (res.index === 0) {
				uni.showModal({
					title: '提示',
					cancelText: 'no',
					confirmText: 'ok',
					content: '点击按钮',
					showCancel: true,
					success(res) {
						console.log(res);
						if (res.cancel) {
							console.log('取消了');
						}
						if (res.confirm) {
							console.log('确定');
						}
					}
				})
			}
		},
		onNavigationBarSearchInputConfirmed(res) {
			console.log(res);
		}
	}
</script>

<style>

</style>
